package com;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import com.init.MpgGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication
public class MbpGeneratorMain {

    public static void main(String[] args) {
        SpringApplication.run(MbpGeneratorMain.class, args);

        // 代码生成器
        AutoGenerator mpg = new AutoGenerator();

        MpgGenerator.setGlobalConfig(mpg);

        MpgGenerator.setDataSource(mpg);

        MpgGenerator.setPackageConfig(mpg);

        MpgGenerator.setTemplate(mpg);

        MpgGenerator.setStrategyConfig(mpg);


        //设置模板引擎
        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
        mpg.execute();

        log.info("代码生成完成！");
        System.exit(0);
    }
}
